package solution

func V1(haystack string, needle string) int {
	if haystack == needle {
		return 0
	}

	hLen := len(haystack)

	nLen := len(needle)

	for m := 0; m < hLen; m++ {
		if m+nLen > hLen {
			return -1
		}

		if haystack[m:m+nLen] == needle {
			return m
		}
	}

	return -1
}
